package com.tmzn.transdata;

import lombok.Data;

@Data
public class RpcResult {

    private boolean ok = false;

    private String msg;

    private Object data;

    public static RpcResult ok(){
        RpcResult rpcResult = new RpcResult();
        rpcResult.setOk(true);
        return rpcResult;
    }
    public static RpcResult success(){
        return ok();
    }

    public static RpcResult ok(Object data){
        RpcResult rpcResult = new RpcResult();
        rpcResult.setOk(true);
        rpcResult.setData(data);
        return rpcResult;
    }

    public static RpcResult success(Object data){

        return ok(data);
    }

    public static RpcResult fail(String msg){
        RpcResult rpcResult = new RpcResult();
        rpcResult.setOk(false);
        rpcResult.setMsg(msg);
        return rpcResult;
    }

}
